use strict;
use utf8;

binmode(STDIN, ":encoding(utf-8)");
binmode(STDOUT, ":encoding(utf-8)");
while (<STDIN>) {
  while ($_ =~ /([А-ЯЁа-яё]+)/g) {
    if (length($1) > 2) {
      print $1 . "\n";
    }
  }
}
